<?php

function resolve($abstract)
{
    return $GLOBALS['ioc']->make($abstract);
}

function collectPathName($url)
{

 return   'collect/'.bin2hex($url);

}
function imgPathName($url)
{
    return   'img/'.bin2hex($url);
}


function compressPathName($url)
{
    return 'compress/';
    return   'compress/'.bin2hex($url);
}

function lastName($name)
{

    $name = explode('\\',$name);

    $name = $name[count($name)-1];
    $name = str_replace('Controller','',$name);
    return $name;
}

function storage_path()
{

   return __DIR__.'/../storage/';
}


function getIp()
{


    $ip_long = [
        array('607649792', '608174079'),
        array('1038614528', '1039007743'),
        array('1783627776', '1784676351'),
        array('2035023872', '2035154943'),
        array('2078801920', '2079064063'),
        array('-1950089216', '-1948778497'),
        array('-1425539072', '-1425014785'),
        array('-1236271104', '-1235419137'),
        array('-770113536', '-768606209'),
        array('-569376768', '-564133889')
    ];


    $rand_key = mt_rand(0, 9);

    $ip= long2ip(mt_rand($ip_long[$rand_key][0], $ip_long[$rand_key][1]));
    return $ip;

}
function zipName($path)
{
	return $path.'.zip';
}

function pngName($path)
{

    return $path.'.png';
}

function timeAndMemory()
{

}

function dd($data = '')
{
    echo  PHP_EOL.PHP_EOL;
    print_r($data);
    echo  PHP_EOL.PHP_EOL;
    $end_memory = memory_get_usage();
    $use_memory = $end_memory - START_MEMORY;
    $use_memory = $use_memory/1024/1024;
    echo '当前脚本消耗内存大小为：'.$use_memory.'MB'.PHP_EOL;
    $end_time = microtime(true);
    $execution_time = ($end_time - START_TIME);
    echo " 脚本执行时间 = ".$execution_time." 秒";
    exit;
}
